package com.im.web.response;

/**
 * 返回码枚举
 */
public enum ReturnCode {
    SUCCESS(200, "操作成功"),
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权访问"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源未找到"),
    METHOD_NOT_ALLOWED(405, "不支持的请求方法"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    
    // 业务相关错误码（6位数字，前3位代表模块，后3位代表具体错误）
    USER_NOT_EXIST(100001, "用户不存在"),
    ORDER_CREATE_FAIL(200001, "IM消息发送失败");

    private final int code;
    private final String message;

    ReturnCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}